package com.jellyfishumbrella.GL;

public class GLColor extends Vector4d implements Cloneable{
	
	public GLColor(){
		super(0,0,0,1);
	}
	
	public GLColor(float r, float g, float b, float a){
		this.x = clamp(r);
		this.y = clamp(g);
		this.z = clamp(b);
		this.w = clamp(a);
	}
	
	public GLColor(double r, double g, double b, double a) {
		this.x = clamp(r);
		this.y = clamp(g);
		this.z = clamp(b);
		this.w = clamp(a);
	}
	
	public GLColor clone(){
		GLColor newGLColor = new GLColor(x, y, z, w);
		return newGLColor;
	}

	private float clamp(float data){
		return (float)Math.min(1.0, Math.max(0.0, data));
	}

	private float clamp(double data){
		return (float)Math.min(1.0, Math.max(0.0, data));
	}
	
	public float r(){
		return (float)x;
	}
	
	public float g(){
		return (float)y;
	}
	
	public float b(){
		return (float)z;
	}
	
	public float a(){
		return (float)w;
	}
}
